#ifndef AI_MANAGER_H_
#define AI_MANAGER_H_

// Includes //
#include "region.h"
#include "object.h"
#include "card/deck.h"
#include "effect/effect.h"
#include "effects_manager.h"

#include <vector>
//////////////

// Constants
#define AI_DELAY 			10000
#define MAX_HAND_SIZE		6
#define MAX_COLORS			6

class AIManager : public EffectsListener
{
public:
	// Singleton Instance Accessor
	static AIManager* 		GetManager ();
	
	// Deconstructor
	virtual ~AIManager ();
	
	// Time passed notification of time that has passed
	// int ms : the amount of milliseconds that has passed
	void TimePassed ( int ms );
	
	/*
	* Loads an initial set of cards into the deck.
	* 
	* @param cards The cards to add.
	**/
	void LoadCards(vector<CardInfo*> cards);
	
	//////////
	// Hand Management
	//////////
	
	/**
	* Attempts to fill the hand with cards.
	**/
	void GrabCards();
	
	/**
	* An effect's state has changed.
	* 
	* Overridden from EffectsListener
	* 
	* @param effect The effect that is updated
	**/
	virtual void EffectStateChanged( Effect* effect );

private:
	// Private constructor
	AIManager ();
	
	////////
	// Deck Management
	////////

	
	/*
	* Pops the top card from the deck and returns it.
	* 
	* @return The top card.
	**/
	Card* PopCard();
	
	/*
	* Discards the card, adding it in the discard pile.
	* 
	* @param card The cards to discard.
	**/
	void Discard(CardInfo* card) { discardDeck->Add(card); }
	
	/*
	 * Plays the card, handling the descarding and popping of the cards, along with the activation
	 * 
	 * @param cardIndex the index of the card in the hand to play
	 **/
	void PlayCard(int cardIndex);
	
	int GetColorIndex(char color);
private:
	// Singleton Instance
	static AIManager* 		instance;
	
	int 					timeToNextAction;
	
	/// The object for the ai's deck
	Object*			deck;

	/// If the region should show the ai's deck size (was this a joke comment/variable?)
	bool			showDeck;
	/// The ai's deck
	Deck*			mainDeck;
	/// The discard deck
	Deck*			discardDeck;
	
	/// The queue of cards to be animated
	vector<Card*>		cardQueue;
	
	vector<int>			alignmentLevels;
};

#endif /*AI_MANAGER_H_*/
